{% extends 'base/base.html' %}

{% block title %}编辑用户{% endblock %}

{% block extra_css %}
<link rel="stylesheet" href="{% static 'css/admin.css' %}">
{% endblock %}

{% block sidebar %}
{# 同dashboard.html的sidebar #}
{% include 'admin/sidebar.html' %}
{% endblock %}

{% block content %}
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
    <h1 class="h2">编辑用户</h1>
</div>

<div class="card">
    <div class="card-body">
        <form method="post">
            {% csrf_token %}
            <div class="mb-3">
                <label for="id_username" class="form-label">用户名</label>
                {{ form.username }}
            </div>
            <div class="mb-3">
                <label for="id_email" class="form-label">邮箱</label>
                {{ form.email }}
            </div>
            <div class="mb-3">
                <label for="id_user_type" class="form-label">用户类型</label>
                {{ form.user_type }}
            </div>
            <div class="mb-3">
                <label for="id_phone" class="form-label">电话</label>
                {{ form.phone }}
            </div>
            <div class="mb-3 form-check">
                {{ form.is_active }}
                <label class="form-check-label" for="id_is_active">活跃状态</label>
            </div>
            <button type="submit" class="btn btn-primary">保存</button>
            <a href="{% url 'accounts:user_list' %}" class="btn btn-secondary">取消</a>
        </form>
    </div>
</div>
{% endblock %}